package utils

import "github.com/mojocn/base64Captcha"

var captchaStore = base64Captcha.DefaultMemStore

func GenerateCapcha() (id, b64s string, err error) {
	driver := base64Captcha.NewDriverDigit(80, 240, 4, 0.7, 80)
	cp := base64Captcha.NewCaptcha(driver, captchaStore)
	id, b64s, _, err = cp.Generate()
	return
}

func VerifyCaptcha(id, answer string) bool {
	return captchaStore.Verify(id, answer, true)
}
